-- wake_up_confused_slime
-- created by chendh
-- 唤醒被混乱的冈布奥

return {
    doAction = function(action)
        local pos = action.pos;
        local data = action.data;
        local grid = DungeonM.getGridByPos(pos);
        if grid.type ~= GRID_TYPE_CONFUSED_SLIME or
            grid.state == GRID_STATE_DISABLE then
            trace("wake_up_confused_slime", "格子：%d不是被混乱的冈布奥，不能执行", pos);
            return false;
        end

        if grid.is_talked == 1 then
            return false;
        end

        grid.is_talked = 1;

        if data == grid.answer then
            -- 设置失效
            --grid:changeState(GRID_STATE_DISABLE);

            -- 选对了。原地召唤召唤兽
            SummonM.doSummon(grid.summon_id, { ["pos"] = pos, });

            -- 抛出事件
            EventMgr.fire(event.WAKE_UP_SLIME, {["summon_id"] = grid.summon_id, ["pos"] = pos, });
        end
    end,
};
